package com.globant.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class TweetSQLHelper extends SQLiteOpenHelper {

	String sqlCreate = "CREATE TABLE tweet " +
            "(_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
            " word TEXT, " +
            " fromUser TEXT, " +
            " profileImageUrl TEXT, " +
            " tweet TEXT, " +
            " createdAt TEXT )";
	
	public TweetSQLHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(sqlCreate);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS Tweet");
        db.execSQL(sqlCreate);		
	}

}
